import { config } from 'dotenv';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';

// 获取项目根目录
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
export const BASE_DIR = join(__dirname, '..');

// 确保加载项目根目录的 .env 文件，不管从哪个目录启动
config({ path: join(BASE_DIR, '.env') });

// 导出路径常量
export const TEMPLATES_DIR = join(BASE_DIR, 'templates');
export const TOOLS_DIR = join(BASE_DIR, 'src', 'tools');
export const CONFIG_DIR = join(BASE_DIR, 'config');
export const DATA_DIR = join(BASE_DIR, 'data');
export const LOGS_DIR = join(BASE_DIR, 'logs');
